package exp2;

import java.util.Scanner;

class Node {
    public int val;
    public Node(int val) {
        this.val = val;
    }
    public Node next;
}

public class T6 {
    public static void main(String[] args) {
        SLlist list = new SLlist();
        Scanner sc = new Scanner(System.in);
        System.out.print("LIST: ");
        String[] str = sc.nextLine().split(",");
        for(int i = 0; i < str.length; i++) {
            list.pushBack(Integer.parseInt(str[i]));
        }
        list.reverse();
        for (int i = 1; i <= list.getSize(); i++) {
            System.out.print(list.get(i) + ",");
        }
    }
}
